package day03;

import java.util.Scanner;

public class Demo04 {
    public static void main(String[] args) {
        //两数之和
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入需要求和的数：");
        int target = sc.nextInt();
        int[] nums = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,16,99,8,77};
        for (int i = 0; i < nums.length - 1; i++) {//i输出到数组倒数第二位就行
            for (int j = i +1; j < nums.length; j++) {//不能相同下标，J就一直在前面一位
                if(nums[i] + nums[j]  == target){
                    System.out.println("两个下标分别是：" + i + "," + j);
                }
            }
        }
    }
}
